1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { notFound } from "next/navigation";
import { examples } from "@/lib/examples";
interface ExamplePageProps {
params: Promise<{
slug?: string[];
}>;
}
export default async function ExamplePage({ params }: ExamplePageProps) {
const { slug } = await params;
const exampleId = slug?.[0];
if (!exampleId) {
notFound();
}
const example = examples.find((e) => e.id === exampleId);
if (!example) {
notFound();
}
return (
<div className="container py-12">
<div className="mb-8">
<h1 className="text-3xl font-bold mb-2">{example.title}</h1>
<p className="text-muted-foreground">{example.description}</p>
</div>
<div className="prose max-w-none">
<p>Example implementation coming soon. Check back for the complete code walkthrough.</p>
</div>
</div>
);
}
export async function generateStaticParams() {
return examples.map((example) => ({
slug: [example.id],
}));
}
export async function generateMetadata({ params }: ExamplePageProps) {
const { slug } = await params;
const exampleId = slug?.[0];
const example = examples.find((e) => e.id === exampleId);
return {
title: example?.title ?? "Example",
description: example?.description ?? "ratkit example",
};
}